#ifndef WIDGET_H
#define WIDGET_H

#include "QHotkey"
#include <QWidget>
#include <QSystemTrayIcon>
#include <QMenu>

QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
class ScreenshotWindow;
QT_END_NAMESPACE

class MainWidget : public QWidget
{
    Q_OBJECT

public:
    explicit MainWidget(QWidget *parent = nullptr);
    ~MainWidget();

public Q_SLOTS:
    void startScreenShot();
    void onSystemTrayActived(QSystemTrayIcon::ActivationReason reason);
    void onShowWindowActionSlot();
    void onExitActionSlot();
    void onPasteOnScreen(const QPixmap &pixmap, const QRect &rect);
    void onScreenShortcutRegisterChanged(bool b);
    void onShortcutSet();
signals:
    void closeScreenshotWindow();
protected:
    void keyPressEvent(QKeyEvent *event);
private:
    void createSystemTray();
    void showMenu();
    void KeyCapture(int key);
private:
    Ui::Widget *ui;
    QSystemTrayIcon m_SystemTray;
    QMenu m_TrayMenu;
    QAction *m_trayExitAction;
    QAction *m_trayShowAction;
    QAction *m_trayScreenshotAction;
    QHotkey m_Hotkey;
    bool m_bCapture;
};
#endif // WIDGET_H
